﻿<u:UUserControl x:Class="UTable.Objects.Controls.UFileExplorer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:u="clr-namespace:UTable.Objects.Controls;assembly=UTable.Core"
    xmlns:local="clr-namespace:UTable.Objects.Controls"
    MinHeight="200" MinWidth="200" Background="Gray">
    <UserControl.Resources>
        <local:FileViewSelector x:Key="fileViewSelector"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="35" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150*" />
                <ColumnDefinition Width="150*" />
            </Grid.ColumnDefinitions>
            <u:UButton Margin="10,3,0,3" Width="120" GlowBrush="Yellow" HorizontalAlignment="Left" x:Name="BackButton" Click="BackButton_Click">Back</u:UButton>
            <u:UButton Grid.Column="1" Margin="0,3,10,3" GlowBrush="Yellow" HorizontalAlignment="Right" Width="120" x:Name="FreshButton" Click="FreshButton_Click">Fresh</u:UButton>
        </Grid>
        <Border Grid.Row="1" CornerRadius="6" Background="White" Margin="5, 0, 5, 3">
            <u:UScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
                <TextBlock FontSize="15" Foreground="Gray" Margin="10, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:UFileExplorer}}, Path=DirectoryPath}"/>
            </u:UScrollViewer>
        </Border>
        <Border Grid.Row="2" CornerRadius="6" Background="White" Margin="5, 0, 5, 0">
            <u:UScrollViewer HorizontalScrollBarVisibility="Disabled">
                <ItemsControl x:Name="FileList" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:UFileExplorer}}, Path=Files}" 
                              ItemTemplateSelector="{StaticResource fileViewSelector}" HorizontalContentAlignment="Stretch" />
            </u:UScrollViewer>
        </Border>
    </Grid>
</u:UUserControl>
